import { Entity, Column, CreateDateColumn, PrimaryColumn } from "typeorm";

@Entity("BBL_USER")
export class User {
  constructor(
    account: string,
    password: string,
    lastLoginTime: Date,
    lastLoginIp: string
  ) {
    this.account = account;
    this.password = password;
    this.lastLoginTime = lastLoginTime;
    this.lastLoginIp = lastLoginIp;
  }

  @PrimaryColumn({
    name: "USER_ID",
    type: "varchar",
    length: 50,
    comment: "用户ID"
  })
  userId: string;

  @Column({
    name: "USER_ACCOUNT",
    type: "varchar",
    length: 255,
    nullable: false,
    comment: "账号"
  })
  account: string;

  @Column({
    name: "USER_PASSWORD",
    type: "varchar",
    length: 255,
    nullable: false,
    comment: "密码"
  })
  password: string;

  @CreateDateColumn({
    name: "LAST_LOGIN_TIME",
    type: "timestamp",
    nullable: true,
    comment: "最后登录时间"
  })
  lastLoginTime: Date;

  @Column({
    name: "LAST_LOGIN_IP",
    type: "varchar",
    length: 255,
    nullable: true,
    comment: "最后登录IP"
  })
  lastLoginIp: string;
}
